]> dgit.raspbian.org Git - gnome-shell.git/commit
st/widget: Don't allow adding/removing "" style class
authorSebastian Keller <skeller@gnome.org>
Fri, 3 Nov 2023 09:07:42 +0000 (10:07 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 5 Dec 2023 23:31:40 +0000 (23:31 +0000)
commitdc931e82cda39812fed670346c7e9b4c293acfd8
treeea7c22d06d0669a1d9e179cd91961110a4c6932f
parentc8dae246457876d0a6a66f816347be9a47ce4378
st/widget: Don't allow adding/removing "" style class

strstr() in find_class_name() will always consider "" a match so the
loop was not stopping at the end of the class_list. None of the matches
within the class_list would satisfy the return conditions, unless the
class_list was either an empty string as well or has a trailing space.
So this ends up with a match outside of the allocated string that
happens to satisfy these conditions by chance which then leads to the
class string containing some of this unrelated memory. Or it might lead
to a segfault.

This adds checks to the public API that uses find_class_name() to
prevent extensions from accidentally triggering a crash this way or
having some otherwise unexpected results.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7152
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3006>
src/st/st-widget.c